package dispatcher.group.gui.elevator;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.BorderFactory;
import javax.swing.JPanel;

/**
 * This class is the panel that holds the elevator car
 * @author Caleb
 *
 */
public class ElevatorCar extends JPanel {

	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3801485376713318135L;

	@SuppressWarnings("unused")
	private byte elevatorCarId;
	
	/**
	 * The main constructor
	 * @param id The ID of the elevator that this car belongs too
	 */
	public ElevatorCar(byte id){
		
		this.elevatorCarId = id;
		
		// Sets the max size of the elevator
		this.setPreferredSize(new Dimension(50, 80));
		this.setMaximumSize(new Dimension(50, 80));
		
		// Sets the border around the car
		this.setBorder(BorderFactory.createLineBorder(Color.BLACK));
	}
	
	/**
	 * A custom paint method
	 */
	@Override
	public void paint(Graphics g){
		super.paint(g);
		
		// Draws a box to represent the elevator car
		g.setColor(Color.RED);
		g.fillRect(this.getX(), this.getY(), 50, 80);
		
	}
}
